Thực đơn
OpenOffice Basic Ví dụMặc dù OpenOffice Basic là một phiên bản tương tự như các phiên bản khác của ngôn ngữ BASIC,như VBA của Microsoft, giao diện lập trình ứng dụng(API) là rất khác, như ví dụ dưới đây của một macro minh họa. Trong khi có một cách dễ dàng hơn để có thể " đếm số đoạn văn" của một tài liệu, tví dụ cho thấy các phương pháp cơ bản để truy cập mỗi đoạn văn trong một tài liệu văn bản, liên tục.
Sub ParaCount'' Count number of paragraphs in a text document' Dim Doc As Object, Enum As Object, TextEl As Object, Count As Long Doc = ThisComponent' Is this a text document? If Not Doc.SupportsService("com.sun.star.text.TextDocument") Then MsgBox "This macro must be run from a text document", 64, "Error" Exit Sub End If Count = 0' Examine each component - paragraph or table? Enum = Doc.Text.CreateEnumeration While Enum.HasMoreElements TextEl = Enum.NextElement' Is the component a paragraph? If TextEl.SupportsService("com.sun.star.text.Paragraph") Then Count = Count + 1 End If Wend'Display result MsgBox Count, 0, "Paragraph Count"End Sub
Thực đơn
OpenOffice Basic Ví dụLiên quan
OpenOffice.org OpenOffice.org Impress OpenOffice Basic OpenOffice.org Draw OpenOffice.org Calc OpenOffice.org Writer OpenOffice.org Base OpenOffice.org MathTài liệu tham khảo
WikiPedia: OpenOffice Basic http://api.openoffice.org/ http://api.openoffice.org/SDK/index.html http://api.openoffice.org/docs/common/ref/com/sun/... http://wiki.services.openoffice.org/wiki/Documenta... http://wiki.services.openoffice.org/wiki/Documenta... http://wiki.services.openoffice.org/wiki/VBA http://www.pitonyak.org/oo.php